%{
#include "nodesconf.tab.h"
%}

%option noyywrap

%s N T C A D

%%

^"# === Groups ==="			return GROUP_BEGIN;
^"# =============="			return END;
"\""					return QUOTE;

^"group_"				BEGIN(N);return GROUP;
^"# === For nodes:"			BEGIN(N);return NODE_BEGIN;
<N>[[:alnum:]]*				nodesconflval.str=strdup(yytext);return NAME;
<N>"="					return EQUAL;

^"table_"				BEGIN(T);return TABLE;
<T>[[:alnum:]]+"."[[:alnum:]_]+		nodesconflval.str=strdup(yytext);return NAME;
<T>"="					BEGIN(D);return EQUAL;

^"condi_"				BEGIN(C);return CONDI;
<C>"="					BEGIN(D);return EQUAL;
<C>[[:alnum:]]+"."[[:alnum:]_]+		nodesconflval.str=strdup(yytext);return NAME;

<D>"<receiver_number>"			return RECEIVER_NUMBER;
<D>"<receiver_name>"			return RECEIVER_NAME;
<D>"<sender_number>"			return SENDER_NUMBER;
<D>"<sender_name>"			return SENDER_NAME;
<D>[[:alnum:]\.\-\'><!()=,* ]		nodesconflval.str=strdup(yytext);return DEF;

^"alias_"				BEGIN(A);return ALIAS;
<A>"="					BEGIN(T);return EQUAL;
<A>[[:alnum:]]+"."[[:alnum:]_]+		nodesconflval.str=strdup(yytext);return NAME;

#[[:alnum:]# ][^=].*			;
[ ]*\n					;

%%
